package com.moon.dao;

import com.moon.entity.TAuction;
import com.moon.vo.TAuctionVo;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface TAuctionMapper extends Mapper<TAuction> {

    @Select("SELECT a.id, a.product_id productId, a.base_price basePrice, a.step_price stepPrice, a.top_price topPrice, a.security_price securityPrice, a.buyer_id buyerId, a.nickname nickName, a.create_time createTime, a.update_time updateTime, a.start_time startTime, a.auction_time auctionTime, a.status, a.join_count JoinCount, p.id pid, p.seller_id sellerId, p.product_name productName, p.product_img productImg, p.product_detail productDetail, p.status pstatus " +
            "FROM t_auction a " +
            "INNER JOIN t_product p " +
            "ON a.product_id = p.id")
    List<TAuctionVo> selectAllTAuctionVo();

    @Select("SELECT a.id, a.product_id productId, a.base_price basePrice, a.step_price stepPrice, a.top_price topPrice, a.security_price securityPrice, a.buyer_id buyerId, a.nickname nickName, a.create_time createTime, a.update_time updateTime, a.start_time startTime, a.auction_time auctionTime, a.status, a.join_count JoinCount, p.id pid, p.seller_id sellerId, p.product_name productName, p.product_img productImg, p.product_detail productDetail, p.status pstatus " +
            "FROM t_auction a " +
            "INNER JOIN t_product p " +
            "ON a.product_id = p.id " +
            "WHERE a.id = #{auctionId}")
    TAuctionVo selectById(Long auctionId);

}